package ui;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JComponent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.LayoutStyle;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class successDialog extends javax.swing.JDialog {
	private JLabel msgLabel;
	private AbstractAction dialogOk;
	private JButton okButton;

	/**
	* Auto-generated main method to display this JDialog
	*/
//	public static void main(String[] args) {
//		SwingUtilities.invokeLater(new Runnable() {
//			public void run() {
//				JFrame frame = new JFrame();
//				successDialog inst = new successDialog(frame);
//				inst.setVisible(true);
//			}
//		});
//	}
	
	public successDialog(JFrame frame) {
		super(frame);
		initGUI();
	}
	
	public void setLabelText(String t) {
		msgLabel.setText(t);
	}
	
	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent)getContentPane());
			getContentPane().setLayout(thisLayout);
			{
				msgLabel = new JLabel();
				msgLabel.setHorizontalAlignment(SwingConstants.CENTER);
				msgLabel.setText("");
			}
			{
				okButton = new JButton();
				okButton.setText("Ok");
				okButton.setAction(getDialogOk());
			}
			thisLayout.setVerticalGroup(thisLayout.createSequentialGroup()
				.addContainerGap(22, Short.MAX_VALUE)
				.addComponent(msgLabel, GroupLayout.PREFERRED_SIZE, 33, GroupLayout.PREFERRED_SIZE)
				.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
				.addComponent(okButton, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
				.addContainerGap());
			thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(thisLayout.createParallelGroup()
				    .addComponent(msgLabel, GroupLayout.Alignment.LEADING, 0, 241, Short.MAX_VALUE)
				    .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup()
				        .addGap(82)
				        .addComponent(okButton, GroupLayout.PREFERRED_SIZE, 86, GroupLayout.PREFERRED_SIZE)
				        .addGap(0, 73, Short.MAX_VALUE)))
				.addContainerGap());
			this.setSize(281, 139);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private AbstractAction getDialogOk() {
		if(dialogOk == null) {
			dialogOk = new AbstractAction("Close", null) {
				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
		}
		return dialogOk;
	}

}
